﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
//using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;

public partial class UserRegister_Activate : System.Web.UI.Page
{
    Operation operation = new Operation();　//声明业务层类对象
    protected void Page_Load(object sender, EventArgs e)
    {
        string sUserID = string.Empty;

        string sID = Request.QueryString["UserID"].Trim();
        msg.Text = sID;
        string sEmail = Server.UrlDecode(Request.QueryString["Em"]).ToString().Trim();

        DataSet ds = operation.ValidateEmail(sEmail);
        if (ds.Tables["tb_user"].Rows.Count <= 0)
        {
            msg.Text = "你还没有注册，请先注册!";
        }
        else
        {
            sUserID = ds.Tables["tb_user"].Rows[0][0].ToString();
            if (sUserID==sID)
            {
                operation.ActiveUser(sID);
                msg.Text = "激活成功！" + "<br/>" + "<a href=\"../Default.aspx\">转到首页</a>";
            }
            else
            {
                msg.Text = "激活失败！ 请联系管理员";
            }
        }
    }
}
